<?php
/**
 * 商品品牌模型
 *
 * 
 *
 *
 * @copyright  Copyright (c) 2007-2013 ShopNC Inc. (http://www.shopnc.net)
 * @license    http://www.shopnc.net
 * @link       http://www.shopnc.net
 * @since      File available since Release v1.1
 */
defined('InShopNC') or exit('Access Invalid!');

class order_virtual_snModel extends Model {
    public function __construct() {
        parent::__construct('order_virtual_sn');
    }

    public function getvirtualList($condition, $field = '*') {
        //$condition['brand_apply'] = 1;
        return $this->where($condition)->field($field)->select();
    }

	public function getOnevirtual($condition){
        return $this->where($condition)->field('*')->order('ov_id desc')->find();
	}
	
	/**
	 * 新增
	 *
	 * @param array $param 参数内容
	 * @return bool 布尔类型的返回结果
	 */
	public function add($param){
		if (empty($param)){
			return false;
		}
		if (is_array($param)){
			$tmp = array();
			foreach ($param as $k => $v){
				$tmp[$k] = $v;
			}
			$result = Db::insert('order_virtual_sn',$tmp);
			return $result;
		}else {
			return false;
		}
	}
	
	/**
	 * 更新信息
	 *
	 * @param array $param 更新数据
	 * @return bool 布尔类型的返回结果
	 */
	public function edit($param){
		if (empty($param)){
			return false;
		}
		if (is_array($param)){
			$tmp = array();
			foreach ($param as $k => $v){
				$tmp[$k] = $v;
			}
			$where = " virtual_sn = '". $param['virtual_sn'] ."'";
			$result = Db::update('order_virtual_sn',$tmp,$where);
			return $result;
		}else {
			return false;
		}
	}
	

}